﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPFIcoFont
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class FontAwesome : Window
    {
        public FontAwesome()
        {
            InitializeComponent();
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            if (MessageBox.Show("Are you sure you want to close the aplication?", "Annoying Prompt", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
            {
                e.Cancel = true;
            }
        }

        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            /* 保存配置 */
            Console.WriteLine(Application.Current.Properties["key1"] as string);
        }

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            /* 加载配置 */
            string[] cmdlines = System.Environment.GetCommandLineArgs();
            foreach (var cmdline in cmdlines)
            {
                Console.WriteLine(cmdline);
            }
            Application.Current.Properties["key1"] = "data1";
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            new ICOList().Show();
        }
    }
}
